package org.skipper.samples.thread.communication;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author shoujian
 * Date: 2022-09-15
 * Time: 17:07
 */
public class ListTest {

    public static void main(String[] args) {
        List<Integer> data = new ArrayList<>();

        data.add(1);
        data.add(2);

        ListTest listTest = new ListTest();
        data = listTest.test(data);

        System.out.println(data);
    }

    public List<Integer> test(List<Integer> data) {
        List<Integer> data2 = new ArrayList<>();
        data2.add(2);
        List<Integer> ss = new ArrayList<>(data);
        data = new ArrayList<>(ss.stream().filter(data2::contains).collect(Collectors.toList()));

        return data;
    }


}
